package com.gpframework.common.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取项目相关配置
 *
 * @Author gpframework
 */
@Component
@ConfigurationProperties(prefix = "gpframework")
public class GpframeworkConfig {
    /**
     * 项目名称
     */
    private String name;

    /**
     * 版本
     */
    private String version;

    /**
     * 版权年份
     */
    private String copyrightYear;

    /**
     * 实例演示开关
     */
    private static boolean demoEnabled;

    /**
     * 验证码类型
     */
    private static String captchaType;

    /**
     * 上传路径
     */
    private static String profile;

    /**
     * 上传路径
     */
    private static String profileAdvanced;

    /**
     * 上传路径
     */
    private static String facePath;

    /**
     * 微信支付回调地址
     */
    private static String wxNotifyUrl;

    /**
     * 图片前缀路径
     */
    private static String prePath;

    /**
     * 域名
     */
    private static String domainName;

    /**
     * 品牌管理上传人脸地址
     */
    private static String adminUploadFace;

    /**
     * 小程序二维码环境
     */
    private static String wxEnvVersion;
    /**
     * 默认线程
     */
    private static int corePoolSize;
    /**
     * 最大线程
     */
    private static int maxPoolSize;
    /**
     * 非对称加密-私钥
     */
    private static String privateKey;
    /**
     * 非对称加密-公钥
     */
    private static String publicKey;

    /**
     * 公众号登录接口
     */
    private static String advancedLoginUrl;

    /**
     * app编号
     */
    private static String uAppKey;
    /**
     * 密钥
     */
    private static String uAppSecret;
    /**
     * 应用id
     */
    private static String uAppId;
    /**
     * 缩略图比例
     */
    private static Integer thumbScale;

    public static Integer getThumbScale() {
        return thumbScale;
    }

    public void setThumbScale(Integer thumbScale) {
        GpframeworkConfig.thumbScale = thumbScale;
    }

    public static String getuAppKey() {
        return uAppKey;
    }

    public static String getuAppSecret() {
        return uAppSecret;
    }

    public static String getuAppId() {
        return uAppId;
    }

    public void setuAppKey(String uAppKey) {
        GpframeworkConfig.uAppKey = uAppKey;
    }

    public void setuAppSecret(String uAppSecret) {
        GpframeworkConfig.uAppSecret = uAppSecret;
    }

    public void setuAppId(String uAppId) {
        GpframeworkConfig.uAppId = uAppId;
    }

    public static String getAdvancedLoginUrl() {
        return advancedLoginUrl;
    }

    public void setAdvancedLoginUrl(String advancedLoginUrl) {
        GpframeworkConfig.advancedLoginUrl = advancedLoginUrl;
    }

    public static String getPrivateKey() {
        return privateKey;
    }

    public void setPrivateKey(String privateKey) {
        GpframeworkConfig.privateKey = privateKey;
    }

    public static String getPublicKey() {
        return publicKey;
    }

    public void setPublicKey(String publicKey) {
        GpframeworkConfig.publicKey = publicKey;
    }

    public static int getCorePoolSize() {
        return corePoolSize;
    }

    public void setCorePoolSize(int corePoolSize) {
        GpframeworkConfig.corePoolSize = corePoolSize;
    }

    public static int getMaxPoolSize() {
        return maxPoolSize;
    }

    public void setMaxPoolSize(int maxPoolSize) {
        GpframeworkConfig.maxPoolSize = maxPoolSize;
    }

    public static String getAdminUploadFace() {
        return adminUploadFace;
    }

    public void setAdminUploadFace(String adminUploadFace) {
        GpframeworkConfig.adminUploadFace = adminUploadFace;
    }

    public static String getDomainName() {
        return domainName;
    }

    public static void setDomainName(String domainName) {
        GpframeworkConfig.domainName = domainName;
    }

    public static String getPrePath() {
        return prePath;
    }

    public void setPrePath(String prePath) {
        GpframeworkConfig.prePath = prePath;
    }

    /**
     * 获取地址开关
     */
    private static boolean addressEnabled;

    public static String getCaptchaType() {
        return captchaType;
    }

    public void setCaptchaType(String captchaType) {
        GpframeworkConfig.captchaType = captchaType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getCopyrightYear() {
        return copyrightYear;
    }

    public void setCopyrightYear(String copyrightYear) {
        this.copyrightYear = copyrightYear;
    }

    public static boolean isDemoEnabled() {
        return demoEnabled;
    }

    public void setDemoEnabled(boolean demoEnabled) {
        GpframeworkConfig.demoEnabled = demoEnabled;
    }

    public static String getProfile() {
        return profile;
    }

    public static String getProfileAdvanced() {
        return profileAdvanced;
    }

    public void setProfileAdvanced(String profileAdvanced) {
        GpframeworkConfig.profileAdvanced = profileAdvanced;
    }

    public static String getFacePath() {
        return facePath;
    }

    public void setProfile(String profile) {
        GpframeworkConfig.profile = profile;
    }

    public void setFacePath(String facePath) {
        GpframeworkConfig.facePath = facePath;
    }

    public static boolean isAddressEnabled() {
        return addressEnabled;
    }

    public void setAddressEnabled(boolean addressEnabled) {
        GpframeworkConfig.addressEnabled = addressEnabled;
    }

    public static String getWxNotifyUrl() {
        return wxNotifyUrl;
    }

    public static void setWxNotifyUrl(String wxNotifyUrl) {
        GpframeworkConfig.wxNotifyUrl = wxNotifyUrl;
    }

    public static String getWxEnvVersion() {
        return wxEnvVersion;
    }

    public void setWxEnvVersion(String wxEnvVersion) {
        GpframeworkConfig.wxEnvVersion = wxEnvVersion;
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath() {
        return getProfile() + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath() {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath() {
        return getProfile() + "/upload";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath(Long brandId, Long storeId) {
        return getProfile() + "/upload" + "/" + brandId + "/" + storeId;
    }

    /**
     * 获取二维码上传路径
     */
    public static String getQrCodePath() {
        return getProfile() + "/qrCode/";
    }

    /**
     * 获取入场码上传路径
     */
    public static String getEntrancePath() {
        return getProfile() + "/entranceCode/";
    }
    public static String getPath() {
        return "/profile/download/";
    }

    /**
     * 绝对路径
     * @param url
     * @return/profile
     */
    public static String getAbsoluteFile(String url) {
        return GpframeworkConfig.getProfile() + url.replace("profile","");
    }
}
